/*
 * Copyright 2011 Angel Sanadinov
 *
 * This file is part of VBox WMI.
 *
 * VBox WMI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VBox WMI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VBox WMI.  If not, see <http://www.gnu.org/licenses/>.
 */

package Utilities;

/**
 * Constants used when dealing with permissions.
 *
 * @author Angel Sanadinov
 */
public class PermissionsConstants
{

//    public static final int PERMISSIONS_NONE = 0;           //000
//    public static final int PERMISSIONS_EXECUTE = 1;        //001
//    public static final int PERMISSIONS_WRITE = 2;          //010
//    public static final int PERMISSIONS_WRITE_EXECUTE = 3;  //011
//    public static final int PERMISSIONS_READ = 4;           //100
//    public static final int PERMISSIONS_READ_EXECUTE = 5;   //101
//    public static final int PERMISSIONS_READ_WRITE = 6;     //110
//    public static final int PERMISSIONS_FULL = 7;           //111

    //masks
    public static final int MASK_ACTION_EXECUTE = 1000;
    public static final int MASK_ACTION_WRITE = 2000;
    public static final int MASK_ACTION_WRITE_EXECUTE = 3000;
    public static final int MASK_ACTION_READ = 4000;
    public static final int MASK_ACTION_READ_EXECUTE = 5000;
    public static final int MASK_ACTION_READ_WRITE = 6000;
    public static final int MASK_ACTION_FULL = 7000;

    //basic actions
    public static final int INVALID_ACTION = 0;
    public static final int BASIC_ACTION_EXECUTE = 1;
    public static final int BASIC_ACTION_WRITE = 2;
    public static final int BASIC_ACTION_READ = 4;
    //3,5,6,7 are reserved
    public static final int BASIC_ACTION_MANAGE_USER = 8;
    public static final int BASIC_ACTION_MANAGE_SERVER = 9;

    //actions that do not need masks
    public static final int ACTION_USER_CREATE = 10;
    public static final int ACTION_USER_REMOVE = 11;
    public static final int ACTION_USER_MODIFY = 12;
    public static final int ACTION_USER_RESET_PASSWORD = 13;
    public static final int ACTION_USER_RESET_OWN_PASSWORD = 14;
    public static final int ACTION_USER_CREATE_PERMISSIONS = 15;
    public static final int ACTION_USER_REMOVE_PERMISSIONS = 16;
    public static final int ACTION_USER_MODIFY_PERMISSIONS = 17;
    public static final int ACTION_SERVER_CREATE = 18;
    public static final int ACTION_SERVER_REMOVE = 19;
    public static final int ACTION_SERVER_MODIFY = 20;

    //all actions below require a suitable mask in order to work properly
    public static final int ACTION_MEDIUM_CREATE_HDD = 21 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_CREATE_HDD_DIFF = 22 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_OPEN_HDD = 23 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_OPEN_DVD = 24 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_OPEN_FDD = 25 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_MERGE = 26 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_CLONE = 27 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_COMPACT = 28 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_RESIZE = 29 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_RESET = 30 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_MODIFY = 31 + MASK_ACTION_WRITE;
    public static final int ACTION_MEDIUM_REMOVE = 32 + MASK_ACTION_WRITE;
    public static final int ACTION_MACHINE_CREATE = 33 + MASK_ACTION_WRITE;
    public static final int ACTION_MACHINE_REMOVE = 34 + MASK_ACTION_WRITE;
    public static final int ACTION_MACHINE_MODIFY_ATTRIBUTES = 35 + MASK_ACTION_WRITE;
    public static final int ACTION_MACHINE_MODIFY_STORAGE = 36 + MASK_ACTION_WRITE;
    public static final int ACTION_MACHINE_MODIFY_LIVE = 37 + MASK_ACTION_WRITE;
    public static final int ACTION_MACHINE_MOUNT_MEDIUM = 38 + MASK_ACTION_WRITE;
    public static final int ACTION_NETWORK_CREATE_DHCP = 39 + MASK_ACTION_WRITE;
    public static final int ACTION_NETWORK_MODIFY_DHCP = 40 + MASK_ACTION_WRITE;
    public static final int ACTION_NETWORK_REMOVE_DHCP = 41 + MASK_ACTION_WRITE;
    public static final int ACTION_NETWORK_CREATE_HOST_IF = 42 + MASK_ACTION_FULL;
    public static final int ACTION_NETWORK_REMOVE_HOST_IF = 43 + MASK_ACTION_FULL;
    public static final int ACTION_NETWORK_MODIFY_HOST_IF = 44 + MASK_ACTION_FULL;
    public static final int ACTION_NETWORK_CREATE_INTERNAL_NET = 45 + MASK_ACTION_WRITE;
    public static final int ACTION_NETWORK_REMOVE_INTERNAL_NET = 46 + MASK_ACTION_WRITE;
    public static final int ACTION_NETWORK_MODIFY_INTERNAL_NET = 47 + MASK_ACTION_WRITE;

    public static final int ACTION_MEDIUM_ATTACH = 48 + MASK_ACTION_EXECUTE;
    public static final int ACTION_MACHINE_CHANGE_STATE = 49 + MASK_ACTION_EXECUTE;
    public static final int ACTION_MACHINE_SNAPSHOT_MANAGE = 50 + MASK_ACTION_WRITE_EXECUTE;
    public static final int ACTION_NETWORK_ATTACH = 51 + MASK_ACTION_EXECUTE;

    public static final int ACTION_RETRIEVE_USERS = 52 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_SERVERS = 53 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_MEDIA = 54 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_MACHINES = 55 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_SNAPSHOTS = 56 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_NETWORKS = 57 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_LOGS = 58 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_SYSTEM = 59 + MASK_ACTION_READ;
    public static final int ACTION_RETRIEVE_MISC = 60 + MASK_ACTION_READ;

    private PermissionsConstants(){}
}
